package com.neuedu.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.neuedu.entity.Beddetails;
import com.neuedu.service.BeddetailsService;
import com.neuedu.vo.ResultJson;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;

/**
 * <p>
 * 床位信息管理表 前端控制器
 * </p>
 *
 * @author wangyu
 * @since 2025-10-16
 */
@RestController
@RequestMapping("/beddetails")
public class BeddetailsController {
    @Resource
    BeddetailsService beddetailsService;
    @GetMapping("/list")
    ResultJson<IPage<Beddetails>> list(Integer pageNo, Integer pageSize, String name, LocalDate startDate, LocalDate endDate, Integer isDeleted) {
        return ResultJson.success(beddetailsService.list(pageNo, pageSize, name, startDate, endDate, isDeleted));
    }
    @GetMapping("/getById")
    ResultJson<Beddetails> getById(Integer id) {
        return ResultJson.success(beddetailsService.getById(id));
    }
    @PostMapping("/update")
    ResultJson<Boolean> update(Beddetails beddetails, Integer roomNo, Integer newbedId) {
        System.out.println(beddetails);
        System.out.println(roomNo);
        System.out.println(newbedId);
        return ResultJson.success(beddetailsService.update(beddetails, roomNo, newbedId), "修改成功");
    }
}
